<?php

namespace app\common\model;

use app\extra\BaseModel;

class School extends BaseModel
{
    use \think\model\concern\SoftDelete;
    protected $deleteTime = 'delete_time';
    public $listExceptField = ['delete_time'];


    public function setTagsAttr($value){
        return serializeByArray($value);
    }
    public function getTagsAttr($value){
        return unSerializeByJson($value);
    }
    /**
     * 添加额外参数
     * @param $item
     */
    public function setAddedField(&$item){
        // $item['public_desc'] = \app\extra\DBCont::getPublishStatus($item['publish']);
        $item['speciality_num'] = model('speciality')->where('school_id', $item['id'])->count();
        $item['department_num'] = model('department')->where('school_id', $item['id'])->count();


    }
}
